package org.nlp.algo.segment;

import java.util.Map;
import org.nlp.algo.classifier.LuceneTokenizerFactory;
import com.aliasi.tokenizer.TokenFeatureExtractor;
import com.aliasi.util.Counter;

/**
 * @author longkeyy
 * 特征提取演示
 *
 */
public class TokenFeatureExtractorDemo {
	public static void main(String[] args) {
		//要提取特征的文本
		CharSequence in = "中华人民共和国";

		//特征提取的中文分词函数
		LuceneTokenizerFactory tokenizerFactory = LuceneTokenizerFactory.INSTANCE;
		
		//特征提取的分词函数英文
//		IndoEuropeanTokenizerFactory instance = indoEuropeanTokenizerFactory.INSTANCE;

		//分词方式特征提取类
		TokenFeatureExtractor featureExtractor = new TokenFeatureExtractor(
				tokenizerFactory);

		//特征提取结果
		Map<String, Counter> features = featureExtractor.features(in);
		for (String k : features.keySet()) {
			System.out.format("key:%s,value:%s\n", k, features.get(k));
		}
	}
}
